package com.dc.datacollect.entity;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Objects;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;

/**
 * 用户（被收集方）
 *
 * @author zhuangjie
 * @TableName user
 * @date 2023/06/27
 */
@Data
public class User implements Serializable {
    /**
     * 被收集方编写
     */
    private Long id;

    /**
     * 收集方登录账号（用户名）
     */
    private String username;
    /**
     * 学号
     */
    private String studentId;
    /**
     * 性别(1男，-1女)
     */
    private Short sex;

    /**
     * 头像图片url
     */
    private String avatar;

    /**
     * 收集方登录密码
     */
    private String password;

    /**
     * 通知邮箱
     */
    private String email;
    /**
     * 用户昵称
     */
    private String nickname;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(id, user.id) && Objects.equals(username, user.username) && Objects.equals(studentId, user.studentId) && Objects.equals(avatar, user.avatar) && Objects.equals(password, user.password) && Objects.equals(email, user.email) && Objects.equals(nickname, user.nickname) && Objects.equals(gmtCreate, user.gmtCreate) && Objects.equals(gmtModified, user.gmtModified);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, username, studentId, avatar, password, email, nickname, gmtCreate, gmtModified);
    }
}